binStr = input()
num = 0
r = 0
for i in range(len(binStr) - 1, -1, -1):
    num += int(binStr[i]) * 2 ** r
    r += 1
print(num)